﻿using mozhi.smarterp.BasicData.Enums;
using System;
using System.Collections.Generic;
using System.Text;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;

namespace mozhi.smarterp.BasicData
{
    public class DataDictionary : AuditedAggregateRoot<Guid>, IMultiTenant
    {
        public bool Activated { private set; get; }

        public Guid? TenantId { get; private set; }

        /// <summary>
        /// 模块
        /// </summary>
        public DataDictType Type { get; private set; }

        /// <summary>
        /// 键
        /// </summary>
        public string Key { get; private set; }


        /// <summary>
        /// 键值
        /// </summary>
        public string Value { get; private set; }


        private DataDictionary() { }

        public DataDictionary(Guid id, DataDictType type, string key, string value)
        {
            Id = id;
            Type = type;
            Key = key;
            Value = value;

            Validate();
        }

        #region
        private void Validate()
        {
            if (Type == default)
                throw new ArgumentNullException(nameof(DataDictionary.Type));

            if (Key.IsNullOrEmpty())
                throw new ArgumentNullException(nameof(Key));
        }
        #endregion
    }
}
